package cn.dapeng.tree.binary;

/**
 * 获取树的最大深度
 */
public class GetTreeDepth {

    public static int getDepth(TreeNode head) {
        if (head == null) {
            return 0;
        }

        return Math.max(getDepth(head.left), getDepth(head.right)) + 1;
    }

}
